﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using FTchina.Library;

public partial class ui_ESS_ShowChart : System.Web.UI.Page
{
    string type = string.Empty;//显示的图表类型
    string IsDYAdmin = string.Empty;
    protected void Page_Load(object sender, EventArgs e)
    {
        type = Server.UrlDecode(  RequestHelper.GetRequst("type"));//表格类型
        IsDYAdmin = RequestHelper.GetRequst("IsDYAdmin");
        string dpt = GetDpt();//获取部门名称分公司名称。
        if (!IsPostBack)
        {
            FTchina.ESS.ESSHighchart ehc = new FTchina.ESS.ESSHighchart();
            if (IsDYAdmin.Length > 0) { ehc.IsDYAdmin = true; }//大领导查看去除各分公司，直接就是全公司
            //string[] month = new string[] { "201201", "201202", "201203", "201204", "201205", "201206", "201207", "201208", "201209" };         
            string[] month = GetMonths();
            if (month.Length == 0)
            {
                Response.Write("月份错误！");
                Response.End();

            }
            string htmltable = string.Empty;






            if (type == "移网出账用户数变化情况")
            {
                ltrChart.Text = ehc.ChartESSDeviceCountGroupByMonth(dpt, month, out htmltable);
                Literal1.Text = htmltable;
            }
            if (type == "2G出账用户数变化情况")
            {
                ltrChart.Text = ehc.ChartESS2GDeviceCountGroupByMonth(dpt, month, out htmltable);
                Literal1.Text = htmltable;
            }
            if (type == "3G出账用户数变化情况")
            {
                ltrChart.Text = ehc.ChartESS3GDeviceCountGroupByMonth(dpt, month, out htmltable);
                Literal1.Text = htmltable;
            }




            if (type == "移网收入变化情况")
            {
                ltrChart.Text = ehc.ChartESSIncome(dpt, month, out htmltable);
                Literal1.Text = htmltable;
            } if (type == "2G收入变化情况")
            {
                ltrChart.Text = ehc.ChartESS2GIncome(dpt, month, out htmltable);
                Literal1.Text = htmltable;
            } if (type == "3G收入变化情况")
            {
                ltrChart.Text = ehc.ChartESS3GIncome(dpt, month, out htmltable);
                Literal1.Text = htmltable;
            }




            if (type == "移网业务收入及用户数变化情况")
            {
                ltrChart.Text = ehc.ChartESSIncomeWithUserCount(dpt, month, out htmltable);
                Literal1.Text = htmltable;
            }
            if (type == "2G收入及用户数变化情况")
            {
                ltrChart.Text = ehc.ChartESS2GIncomeWithUserCount(dpt, month, out htmltable);
                Literal1.Text = htmltable;
            }
            if (type == "3G收入及用户数变化情况")
            {
                ltrChart.Text = ehc.ChartESS3GIncomeWithUserCount(dpt, month, out htmltable);
                Literal1.Text = htmltable;
            }
            if (type == "按收入来源移网收入变化情况")
            {
                ltrChart.Text = ehc.ChartESSIncomeBySource(dpt, month, out htmltable);
                Literal1.Text = htmltable;
            }
            if (type == "按收入来源移网出账用户数变化情况")
            {
                ltrChart.Text = ehc.ChartESSUserCountBySource(dpt, month, out htmltable);
                Literal1.Text = htmltable;
            }






            if (type == "固网收入及用户数变化情况")
            {
                ltrChart.Text = ehc.ChartESSGWIncomeWithUserCount(dpt, month, out htmltable);
                Literal1.Text = htmltable;
            }
            if (type == "固话收入及用户数变化情况")
            {
                ltrChart.Text = ehc.ChartESSGHIncomeWithUserCount(dpt, month, out htmltable);
                Literal1.Text = htmltable;
            }
            if (type == "宽带收入及用户数变化情况")
            {
                ltrChart.Text = ehc.ChartESSKDIncomeWithUserCount(dpt, month, out htmltable);
                Literal1.Text = htmltable;
            } 
            if (type == "小灵通收入及用户数变化情况")
            {
                ltrChart.Text = ehc.ChartESSXLTIncomeWithUserCount(dpt, month, out htmltable);
                Literal1.Text = htmltable;
            }
            if (type == "固网收入构成情况")
            {
                ltrChart.Text = ehc.ChartESSGWIncome(dpt, month, out htmltable);
                Literal1.Text = htmltable;
            }

            if (type == "全业务收入构成情况")
            {
                ltrChart.Text = ehc.ChartESSQYWIncome(dpt, month, out htmltable);
                Literal1.Text = htmltable;
            }
            if (type == "全业务用户数分布情况")
            {
                ltrChart.Text = ehc.ChartESSQYWUserCount(dpt, month, out htmltable);
                Literal1.Text = htmltable;
            }
            






            if (type == "test")
            {

                ltrChart.Text = ehc.ChartEssDeviceCountByCitycode();
                Literal1.Text = htmltable;
            }
        }
    }


    /// <summary>
    /// 获取选择的月份
    /// </summary>
    /// <returns></returns>
    protected string[] GetMonths()
    {
        string month = FTchina.Library.RequestHelper.GetRequst("month");
        return month.Split(',');
    }
    /// <summary>
    /// 获取分公司
    /// </summary>
    /// <returns></returns>
    protected string GetDpt()
    {
        return Server.UrlDecode( FTchina.Library.RequestHelper.GetRequst("Dpt"));
    }

}